package com.spzx.user.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.user.api.domain.UpdateUserLogin;
import com.spzx.user.api.domain.UserInfo;
import com.spzx.user.api.service.RemoteUserInfoService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteUserInfoFallbackFactory implements FallbackFactory<RemoteUserInfoService> {
    @Override
    public RemoteUserInfoService create(Throwable cause) {
        return new RemoteUserInfoService() {
            @Override
            public R<Boolean> register(UserInfo userInfo, String source) {
                return R.fail("注册失败");
            }

            @Override
            public R<UserInfo> getUserInfoByUsername(String username, String source) {
                return R.fail("获取登录信息失败");
            }

            @Override
            public R<Boolean> updateUserLogin(UpdateUserLogin updateUserLogin, String source) {
                return R.fail("登录更新ip和时间失败");
            }

        };
    }
}
